package com.daoeping.test;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;


public class ProxyHandle implements InvocationHandler{
	private Object target;
	DogInterceptor dogInterceptor = new DogInterceptor();
	@Override
	public Object invoke(Object proxy, Method method, Object[] args)
			throws Throwable {
		Object result = null;
		if(method.getName().equals("info")){
			dogInterceptor.method1();
			result = method.invoke(target, args);
			dogInterceptor.method2();
		}else{
			result = method.invoke(target, args);
		}
		return result;
	}
	public void setTarget(Object target) {
		this.target = target;
	}

}
